import MetaData from "./MetaData";
import CoreExpression from "./abstract/CoreExpression";
import UnchangedExpression from "./impl/UnchangedExpression";
import Expression from "./interface/Expression";

class LimitExpression extends CoreExpression {
    protected data: string;

    constructor(metadata: MetaData, value: number) {
        super(metadata);
        this.data = "limit " + value;
    }

    public offset(offset: number): Expression {
        this.metadata.add(new UnchangedExpression("offset " + offset))
        return this as Expression;
    }

    toLocaSql(): string {
        return this.data;
    }
}

export = LimitExpression;